package com.android.client.presenter;


import com.android.client.GreetingServiceAsync;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.Widget;

/**
 * 
 * @author bruce
 * Presenter Abstract 
 */
public abstract class AbstractPresenter {
	protected Widget view;

	protected HandlerManager eventBus;

	protected GreetingServiceAsync service;
	
	protected PresenterManager pm;

	protected AbstractPresenter(Widget view, HandlerManager eventBus,
			GreetingServiceAsync service) {
		this.view = view;
		this.eventBus = eventBus;
		this.service = service;
		this.pm = PresenterManager.getInstance();
		bind();
	}
	
	protected abstract void bind();
	
	/**
	 * Get view of this presenter 
	 * One presenter share one widget with event
	 * @return view
	 */
	@SuppressWarnings("unchecked")
	public <T extends Widget> T getView(){
		return (T) view;
	}
}
